package com.lightsaber.trade.as.entity.dataimport;

import java.util.LinkedHashMap;
import java.util.Map;

public enum DataimportStatus {
    Pending, Running, Failed, Success;

    public static Map<String, String> list() {
        Map<String, String> map = new LinkedHashMap<String, String>();

        for (DataimportStatus sta : DataimportStatus.values()) {
            map.put(sta.toString(), sta.toString());
        }

        return map;
    }

    public static DataimportStatus getStatusByName(final String statusString) {
        if (statusString.equalsIgnoreCase(DataimportStatus.Pending.toString())) {
            return DataimportStatus.Pending;
        } else if (statusString.equalsIgnoreCase(DataimportStatus.Running.toString())) {
            return DataimportStatus.Running;
        } else if (statusString.equalsIgnoreCase(DataimportStatus.Failed.toString())) {
            return DataimportStatus.Failed;
        } else if (statusString.equalsIgnoreCase(DataimportStatus.Success.toString())) {
            return DataimportStatus.Success;
        }
        return null;
    }
}
